package com.atguigu.gulimall.search.third;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class TestThird {
    public static ExecutorService service =  Executors.newFixedThreadPool(12);

    public static void main(String[] args) {
//        Test test = new Test();
//        test.start();
        Test2 test2 = new Test2();
//        new Thread(test2).start();
        service.submit(test2);
    }

    /**
     * 继承Third实现异步，创建线程
     */
    public static class  Test extends Thread{

        @Override
        public void run() {
            System.out.println("当前线程"+Thread.currentThread().getId());
        }
    }

    public static class Test2 implements Runnable{

        @Override
        public void run() {
            System.out.println("创建当前线程"+Thread.currentThread().getId());
        }
    }

    public static void Test3 () {

        System.out.println("666");


    }
}
